﻿/********************************************************
 * 作者：SFJoy
 * 时间：2009/04/02
 * 描述：sql语句创建对象的接口
 ********************************************************/
using System;
using System.Collections.Generic;

namespace UtilityLibrary.Ormapping
{
    public interface ISqlCreater
    {
        /// <summary>
        /// 获得查询sql语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlSelect(Type type);

        /// <summary>
        /// 获得根据条件查询的sql语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="condition">查询条件</param>
        /// <returns></returns>
        String GetSqlSelect(Type type, String condition);

        /// <summary>
        /// 获得根据条件查询的sql语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="conditions">条件集合</param>
        /// <returns></returns>
        String GetSqlSelect(Type type, IList<String> conditions);

        /// <summary>
        /// 分页查询语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="pageSize">每页数量</param>
        /// <param name="pageIndex">页数</param>
        /// <returns></returns>
        String GetSqlPagedSelect(Type type, Int32 pageSize, Int32 pageIndex);

        /// <summary>
        /// 分页查询语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="pageSize">每页数量</param>
        /// <param name="pageIndex">页数</param>
        /// <param name="pageIndex">查询条件</param>
        /// <returns></returns>
        String GetSqlPagedSelect(Type type, Int32 pageSize, Int32 pageIndex, String condition);

        /// <summary>
        /// 获得查数语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlCount(Type type);

        /// <summary>
        /// 获得根据条件的查数语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="condition">查数条件</param>
        /// <returns></returns>
        String GetSqlCount(Type type, String condition);

        /// <summary>
        /// 获得根据条件的查数语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="conditions">查数条件集合</param>
        /// <returns></returns>
        String GetSqlCount(Type type, IList<String> conditions);

        /// <summary>
        /// 获得插入语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlInsert(Type type);

        /// <summary>
        /// 获得插入语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlInsert(Type type, Int32 listCount);

        /// <summary>
        /// 创建sql语句GetIdentity
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlGetIdentity(Type type);

        /// <summary>
        /// 创建sql语句Update
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlUpdate(Type type);

        /// <summary>
        /// 创建sql语句Update
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlUpdate(Type type, Int32 listCount);

        /// <summary>
        /// 创建sql语句Delete
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlDelete(Type type);

        /// <summary>
        /// 创建sql语句Delete
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="olist">实体类集合</param>
        /// <returns></returns>
        String GetSqlDelete(Type type, Int32 listCount);

        /// <summary>
        /// 创建根据条件删除的sql语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="condition">条件</param>
        /// <returns></returns>
        String GetSqlConditionDelete(Type type, String condition);

        /// <summary>
        /// 创建根据条件删除的sql语句
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <param name="condition">条件集合</param>
        /// <returns></returns>
        String GetSqlConditionDelete(Type type, IList<String> conditions);

        /// <summary>
        /// 创建sql语句GetDetails
        /// </summary>
        /// <param name="t">实体类类型</param>
        /// <returns></returns>
        String GetSqlGetDetails(Type type);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        String ParamName(String fieldName);
    }
}
